package com.geeke.sys.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.geeke.common.persistence.DataEntity;
import java.util.*;

/**
 * 资源表Entity
 */
public class Resource extends DataEntity<Resource> {

    private static final long serialVersionUID = 1L;
    
    public Resource() {
        super();
    }
    
    public Resource(String id) {
        super(id);
    }

    @Length(min = 1, max = 128, message = "名称长度必须介于1和128之间")
    @NotBlank(message = "名称不能为空")
    private String name;
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }

    @Length(min = 0, max = 255, message = "备注信息长度必须介于0和255之间")
    private String remarks;
    
    public String getRemarks() {
        return remarks;
    }
    
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    @Length(min = 1, max = 64, message = "编号长度必须介于1和64之间")
    @NotBlank(message = "编号不能为空")
    private String code;
    
    public String getCode() {
        return code;
    }
    
    public void setCode(String code) {
        this.code = code;
    }

    @Length(min = 1, max = 128, message = "URL长度必须介于1和128之间")
    @NotBlank(message = "URL不能为空")
    private String url;
    
    public String getUrl() {
        return url;
    }
    
    public void setUrl(String url) {
        this.url = url;
    }

    @Length(min = 0, max = 32, message = "权限长度必须介于0和32之间")
    private String permission;
    
    public String getPermission() {
        return permission;
    }
    
    public void setPermission(String permission) {
        this.permission = permission;
    }

    @Length(min = 1, max = 1, message = "可以授权长度必须为1")
    @NotBlank(message = "可以授权不能为空")
    private String canPermission = "1";
    
    public String getCanPermission() {
        return canPermission;
    }
    
    public void setCanPermission(String canPermission) {
        this.canPermission = canPermission;
    }

    @Length(min = 1, max = 1, message = "默认资源长度必须为1")
    @NotBlank(message = "默认资源不能为空")
    private String isDefault = "0";
    
    public String getIsDefault() {
        return isDefault;
    }
    
    public void setIsDefault(String isDefault) {
        this.isDefault = isDefault;
    }

    @Length(min = 0, max = 1, message = "禁用长度必须为1")
    private String isLocked = "0";
    
    public String getIsLocked() {
        return isLocked;
    }
    
    public void setIsLocked(String isLocked) {
        this.isLocked = isLocked;
    }

    private Router router = new Router();
    
    public Router getRouter() {
        return router;
    }
    
    public void setRouter(Router router) {
        this.router = router;
    }

    @Override
    public String getTableAlias() {
        return "resource";
    }
} 